package semanticlib;
/**
  * SemType implements a representation of types for supporting
  * typechecking of simple languages.
  */

public enum SemType {
    INT("int"), BOOL("bool"), VOID("void"), STRING("string"), UNKNOWN("unkown");

    private final String name;
    private SemType(String name){
	this.name = name;
    }
    public String toString(){
	return name;
    }
    public static SemType parseType(String incoming){
	for(SemType t : SemType.values()){
	    if(incoming.contains(t.toString()))
		return t;
	}
	return UNKNOWN;
    }
    public boolean equals(String incoming){
	return name.equals(incoming);
    }
    public boolean equals(SemType incoming){
	return name.equals(incoming.toString());
    }



}
